/*
 * @author Chris
 * @since 2023/1/25 14:26
 *
 * @brief    The project will ...
 *
 * @note     ...
 *
 * @warning  Do not to ...
 *
 * Change Logs:
 *   Date           Author       Notes
 *   2023/1/25     Chris        the first version
 */

#include "reg51.h"

int putchar(int c) {
    TI = 0;
    SBUF = c;
    while (TI == 0);

    TI = 0;
    ES = 1;

    return c;
}

void ConfigUART(unsigned int baud) {
    SCON |= 0x50;
    TMOD |= 0x20;
    TH1 = 256 - (11059200 / 12 / 2 / 16) / baud;
    TL1 = TH1;

    ET1 = 0;
    ES = 1;
    TR1 = 1;
}
